<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8" />
		<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
		<title>工作台</title>
		<link rel="stylesheet" type="text/css" href="css/work.css"/>
		<script type="text/javascript" src="js/jquery-2.1.0.js" ></script>
		<script type="text/javascript" src="js/rem.js" ></script>
		<script src="//res.wx.qq.com/open/js/jweixin-1.2.0.js"></script>
	</head>
	<body>
		<div class="main">
			<div class="daka">
				<dl>
					<dt><img src="img/images/1.jpg"/></dt>
					<dd>打卡</dd>
				</dl>
				<dl>
					<dt><img src="img/images/2.jpg"/></dt>
					<dd>审批</dd>
				</dl>
				<dl>
					<dt><img src="img/images/3.jpg"/></dt>
					<dd>汇报</dd>
				</dl>
				<dl>
					<dt><img src="img/images/4.jpg"/></dt>
					<dd>公告</dd>
				</dl>
				<dl>
					<dt><img src="img/images/5.jpg"/></dt>
					<dd>档案</dd>
				</dl>
				<dl>
					<dt><img src="img/images/6.jpg"/></dt>
					<dd>合同管理</dd>
				</dl>
				<dl>
					<dt><img src="img/images/7.jpg"/></dt>
					<dd>日记事</dd>
				</dl>
			</div>
			<div class="baoxiao">
				<dl>
					<dt><img src="img/images/8.jpg"/></dt>
					<dd>报销申请</dd>
				</dl>
				<dl>
					<dt><img src="img/images/9.jpg"/></dt>
					<dd>备用金申请</dd>
				</dl>
				<dl>
					<dt><img src="img/images/10.jpg"/></dt>
					<dd>付款申请</dd>
				</dl>
				<dl>
					<dt><img src="img/images/11.jpg"/></dt>
					<dd>算工资</dd>
				</dl>
				<dl>
					<dt><img src="img/images/12.jpg"/></dt>
					<dd>现金日记账</dd>
				</dl>
				<dl>
					<dt><img src="img/images/13.jpg"/></dt>
					<dd>提成结算</dd>
				</dl>
				<dl>
					<dt><img src="img/images/14.jpg"/></dt>
					<dd>我的账户</dd>
				</dl>
			</div>
			<div class="huixiao">
				<dl>
					<dt><img src="img/images/15.jpg"/></dt>
					<dd>会销</dd>
				</dl>
				<dl>
					<dt><img src="img/images/16.jpg"/></dt>
					<dd>学校管理</dd>
				</dl>
				<dl>
					<dt><img src="img/images/17.jpg"/></dt>
					<dd>报计划</dd>
				</dl>
				<dl>
					<dt><img src="img/images/18.jpg"/></dt>
					<dd>图书批发</dd>
				</dl>
				<dl>
					<dt><img src="img/images/19.jpg"/></dt>
					<dd>图书零售</dd>
				</dl>
				<dl>
					<dt><img src="img/images/20.jpg"/></dt>
					<dd>产品列表</dd>
				</dl>
				<dl>
					<dt><img src="img/images/21.jpg"/></dt>
					<dd>赠品</dd>
				</dl>
				<dl>
					<dt><img src="img/images/22.jpg"/></dt>
					<dd>任务单</dd>
				</dl>
				<dl>
					<dt><img src="img/images/23.jpg"/></dt>
					<dd>工作轨迹</dd>
				</dl>
				<dl>
					<dt><img src="img/images/24.jpg"/></dt>
					<dd>报备</dd>
				</dl>
				<dl>
					<dt><img src="img/images/25.jpg"/></dt>
					<dd>本周开会地区查询</dd>
				</dl>
				<dl>
					<dt><img src="img/images/26.jpg"/></dt>
					<dd>派讲师</dd>
				</dl>
				<dl>
					<dt><img src="img/images/27.jpg"/></dt>
					<dd>周销售统计</dd>
				</dl>
				<dl>
					<dt><img src="img/images/28.jpg"/></dt>
					<dd>客服</dd>
				</dl>
			</div>
			<div class="yaohuo">
				<dl>
					<dt><img src="img/images/29.jpg"/></dt>
					<dd>要货</dd>
				</dl>
				<dl>
					<dt><img src="img/images/30.jpg"/></dt>
					<dd>收发货</dd>
				</dl>
				<dl>
					<dt><img src="img/images/31.jpg"/></dt>
					<dd>库存</dd>
				</dl>
				<dl>
					<dt><img src="img/images/32.jpg"/></dt>
					<dd>印制</dd>
				</dl>
			</div>
			<div class="gongju">
				<dl>
					<dt><img src="img/images/33.jpg"/></dt>
					<dd>工具</dd>
				</dl>
				<dl>
					<dt><img src="img/images/34.jpg"/></dt>
					<dd>年度日程总表</dd>
				</dl>
				<dl>
					<dt><img src="img/images/35.jpg"/></dt>
					<dd>企业邮箱</dd>
				</dl>
			</div>
		</div>
		<div class="footer">
			<dl>
				<dt><img src="img/images/footer_1.jpg"/></dt>
				<dd>消息</dd>
			</dl>
			<dl>
				<dt id="work"><img src="img/images/footer_2.jpg"/></dt>
				<dd>通讯录</dd>
			</dl>
			<dl>
				<dt><img src="img/images/footer_3.jpg"/></dt>
				<dd class="xuan">工作台</dd>
			</dl>
			<dl>
				<dt><img src="img/images/footer_4.jpg"/></dt>
				<dd>我</dd>
			</dl>
		</div>
		<?php

		?>
		<script>
          	var url = "http://oa.fc62.com/work/";
            $.ajax({
                url:'http://oa.fc62.com/api/demo/jssdk',
                type: 'post',
				data: {'url':url},
                dataType: "json",
                success: function (data)
                {
                    console.log(data.data);
                    wx.config(data.data);
                }
            });
            wx.checkJsApi({
                jsApiList: ['selectEnterpriseContact','openEnterpriseChat'], // 需要检测的JS接口列表，所有JS接口列表见附录2,
                success: function(res) {
                    // 以键值对的形式返回，可用的api值true，不可用为false
                    // 如：{"checkResult":{"chooseImage":true},"errMsg":"checkJsApi:ok"}
                    alert(res)
                }
            });
            wx.ready(function(){

                document.querySelector('#work').onclick = function () {

                    wx.invoke("selectEnterpriseContact", {
                            "fromDepartmentId": -1,// 必填，-1表示打开的通讯录从自己所在部门开始展示, 0表示从最上层开始
                            "mode": "single",// 必填，选择模式，single表示单选，multi表示多选
                            "type": ["department", "user"],// 必填，选择限制类型，指定department、user中的一个或者多个
                            "selectedDepartmentIds": [],// 非必填，已选部门ID列表。用于多次选人时可重入
                            "selectedUserIds": []// 非必填，已选用户ID列表。用于多次选人时可重入
                        },function(res){
                            if (res.err_msg == "selectEnterpriseContact:ok")
                            {
                                if(typeof res.result == 'string')
                                {
                                    alert('不兼容');
                                    res.result = JSON.parse(res.result) //由于目前各个终端尚未完全兼容，需要开发者额外判断result类型以保证在各个终端的兼容性
                                }
                                var selectedDepartmentList = res.result.departmentList;// 已选的部门列表
                                for (var i = 0; i < selectedDepartmentList.length; i++)
                                {
                                    var department = selectedDepartmentList[i];
                                    var departmentId = department.id;// 已选的单个部门ID
                                    var departemntName = department.name;// 已选的单个部门名称
                                }
                                var selectedUserList = res.result.userList; // 已选的成员列表
                                for (var i = 0; i < selectedUserList.length; i++)
                                {
                                    var user = selectedUserList[i];
                                    var userId = user.id; // 已选的单个成员ID
                                    var userName = user.name;// 已选的单个成员名称
                                    var userAvatar= user.avatar;// 已选的单个成员头像
                                }
                                // alert(userId + userName + userAvatar);
                                wx.invoke('openUserProfile', {
                                    "type": 1, //1表示该userid是企业成员，2表示该userid是外部联系人
                                    "userid": userId //可以是企业成员，也可以是外部联系人
                                }, function(res){
                                    if(res.err_msg != "openUserProfile:ok"){
                                        //错误处理
                                    }
                                });
                            }
                        }
                    );
				}

            });
		</script>
	</body>
</html>
